﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate;
using NHibernate.Cfg;
using System.Reflection;
namespace Lion
{
    public sealed class NHibernateUtil
    {

        private static readonly ISessionFactory SessionFactory;
        
        static NHibernateUtil()
        {
            Configuration cfg = new Configuration();
            cfg.AddAssembly(Assembly.GetCallingAssembly());
            SessionFactory = cfg.BuildSessionFactory();
        }

        public static ISession OpenSession()
        {
            return SessionFactory.OpenSession();
        }

        public static IStatelessSession OpenStatelessSession()
        {
            return SessionFactory.OpenStatelessSession();
        }
    }
}
